package com.rany.day07.demo04;

import java.util.ArrayList;
import java.util.Iterator;

public class Test02 {
    public static void main(String[] args) {
        ArrayList<Integer> list1 = new ArrayList<>();
        list1.add(25);
        list1.add(42);

        ArrayList<String> list2 = new ArrayList<>();
        list2.add("lulu");
        list2.add("lin");

        demo02(list1);
        demo02(list2);
    }

    private static void demo02(ArrayList<?> list) {
        Iterator<?> iterator = list.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
        }
    }

}
